package com.common.library.ui.view;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.VideoView;

/**
 * @author shun
 * @version V1.0
 * @Title: //file name
 * @Package com.zhsj.tvbee.android.ui.view
 * @date 16/7/5 16:50
 */
public class CustomVideoView extends VideoView {
    public CustomVideoView(Context context) {
        super(context);
    }

    public CustomVideoView(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public CustomVideoView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
        int width = getDefaultSize(0, widthMeasureSpec);
        int height = getDefaultSize(0, heightMeasureSpec);
        if (width > height) {
            setMeasuredDimension(width, height);
            return;
        }
        //翻转
        width = width ^ height;
        height = height ^ width;
        width = width ^ height;
        setMeasuredDimension(width, height);
    }
}
